#include <iostream>
#include <vector>

using namespace std;

// Function to calculate popcount of an integer
int popcount(long long x) {
    int count = 0;
    while (x) {
        count += x & 1;
        x >>= 1;
    }
    return count;
}

// Main function to find a pair (X, Y) given a, b, and C
void findPair(int a, int b, long long C) {
    long long X = 0, Y = 0;
    int shared_bits = 0;

    // Loop through each bit position from 0 to 59 (since 0 <= C < 2^60)
    for (int i = 59; i >= 0; --i) {
        long long bit = 1LL << i;

        if (C & bit) {
            // If the current bit in C is 1, we need to set this bit in either X or Y but not both
            if (a > b) {
                X |= bit; // Assign the bit to X, decreasing its remaining popcount requirement
                a--;
            } else {
                Y |= bit; // Assign the bit to Y, decreasing its remaining popcount requirement
                b--;
            }
        } else {
            // If the current bit in C is 0, postpone the decision on how to assign the bit
            shared_bits++;
        }
    }

    // Check if we have enough shared positions to satisfy the remaining popcount requirements
    if (a + b > shared_bits || a < 0 || b < 0) {
        cout << "-1\n";
        return;
    }

    // Assign shared bits to meet the exact popcount requirements for X and Y
    for (int i = 0; i < 60 && (a > 0 || b > 0); ++i) {
        long long bit = 1LL << i;

        // Only assign if this bit was not already decided by the C's bit being 1
        if (!(C & bit)) {
            if (a > 0) {
                X |= bit;
                a--;
            } 
            if (b > 0) {
                Y |= bit;
                b--;
            }
        }
    }

    cout << X << " " << Y << endl;
}

int main() {
    int a, b;
    long long C;
    cin >> a >> b >> C;
    
    findPair(a, b, C);

    return 0;
}

